<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link type="text/css" rel="stylesheet" href="main.css">
    
	<!--jquery -->
	<script type="text/javascript" src="../js/jquery/jquery-2.0.3.min.js" ></script>
	
	<script type="text/javascript" src="../js/share.js"></script>
		
	<script type="text/javascript">
	var itemno = "";
	var applyid = "";
	var nodeno = "";
	var orgcode = "";
	var nextnodecode1 = "";
	var selectID = "userlist";
	var applyno = "";

	$(function(){
		applyno = getUrlParam("applyno");
		bindApply(applyno);
	})


	function bindApply(applyno){
		$.ajax({ 
			url: basePath() + 'business/getapplyinfo.do',
			data: {"applyno": applyno},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonApply = data.datas;
//		    		var jsonBusiness = data.datas.business;
//		    		var jsonMaterial = data.datas.material;
		    		
		    		bindApplyForm(jsonApply);
		    		
		    		//绑定业务资料
		    		bindBusinessForm(jsonApply['applyid'], jsonApply['itemno']);
//		    		
//		    		//绑定附件材料
		    		bindMaterialListForm(jsonApply['applyid']);	    
		    	}
	      	}
		});
	}

	function bindApplyForm(jsonApply){
		for(var d in jsonApply){//遍历json对象的每个key/value对,p为key
			if(d == 'applytime'){
				$('#' + d).html(formatDate(jsonApply[d], 'yyyy-mm-dd'));
			}
			else if(d == 'nodename'){
				if(jsonApply[d] == '办结')
					$('#' + d).html('<span style="color:green;font-weight: bold;">' + jsonApply[d] + '</span>');
				else if(jsonApply[d].indexOf('补正') >= 0){
					$('#' + d).html('<span style="color:red;font-weight: bold;">' + jsonApply[d] + '</span>');
					$('#correction').show();
					$('#correction').attr('href', 'correction.html?applyno=' + applyno);
				}
				else if(jsonApply[d].indexOf('申报') >= 0){
					$('#' + d).html('<span style="color:red;font-weight: bold;">未提交</span>');
					$('#edit').show();
					$('#edit').attr('href', 'edit.html?applyno=' + applyno);
				}
	        	else if(jsonApply[d].indexOf('受理') >= 0)
	        		$('#' + d).html('<span style="color:blue; font-weight: bold;">待受理</span>');
				else{
					$('#' + d).html('<span style="color:blue;font-weight: bold;">已受理</span>');
				}
			}
			else{
				$('#' + d).html(jsonApply[d] == '' ? '/' : jsonApply[d]);
			}
		}
	}

	function bindBusinessForm(applyid, itemno){

		$.ajax({ 
			url: basePath() + 'business/getbusinessinfo.do',
			data: {"applyid": applyid, "itemno": itemno},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonBusiness = data.datas;

		    		for(var d in jsonBusiness){	//遍历json对象的每个key/value对,d为key
		    			if(d == 'worktime'){
		    				$('#' + d).html(formatDate(jsonBusiness[d], 'yyyy-mm-dd'));
		    			}
		    			else{
		    				$('#' + d).html(jsonBusiness[d] == '' ? '/' : jsonBusiness[d]);
		    			}
		    		}
		    	}
	      	}
		});
	}

	function bindMaterialListForm(applyid){

		$.ajax({ 
			url: basePath() + 'business/getmaterialinfo.do',
			data: {"applyid": applyid},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonMaterial = data.datas;

					var k = 1;
					for(var i = 0; i < jsonMaterial.length; i++){
						var materialname = jsonMaterial[i]['materialname'];
						
						var fileid=jsonMaterial[i]['fileid']
						if('' != fileid){
							var materialnameHmtl = k + '、' + materialname + '<br />';
							$('#material').append(materialnameHmtl);
							k++;
						}
					}
		    	}
	      	}
		});
	}

	</script>
	
    <style>
        table{
        border-style: solid;
        border-width: 1px;
        border-color: black;
        border-collapse: collapse;
        }
    </style>
    <title>海上拖带大型设施和移动式平台申请书</title>
</head>
<body>
<h1 style="margin-bottom: 30px;font-size: 18px">海上拖带大型设施和移动式平台申请书</h1>
<table border="1"  align="center" cellspacing="0" cellpadding="0">
    <tr>
        <td class="td-1">申请人</td>
        <td class="td-2" style="text-align: left;">
        	<span id="proposer" style=" margin-left: 10px;"></span>
        </td>
    </tr>
    <tr>
        <td class="td-1">申请时间</td>
        <td class="td-2" style="text-align: left;">
        	<span id="applytime" style=" margin-left: 10px;"></span>
        </td>
    </tr>
    <tr>
        <td class="td-1">拖带计划</td>
        <td class="td-2" style="text-align: left;">
        	<span id="towingcontent" style=" margin-left: 10px;"></span>
        </td>
    </tr>
    <tr>
        <td class="td-1">拖 轮</td>
        <td class="td-2" style="text-align: left;">
        	<span id="workshipname" style=" margin-left: 10px;"></span>
        </td>
    </tr>
    <tr>
        <td class="td-1">被拖物</td>
        <td class="td-2" style="text-align: left;">
        	<span id="towingname" style=" margin-left: 10px;"></span>
       	</td>
    </tr>
    <tr>
        <td class="td-6">
            <br>附<br>送<br>资<br>料
        </td>
        <td class="td-2" style="text-align: left;">
        	<p id="material" style=" margin-left: 10px;"></p>
        </td>
    </tr>
     <tr>
        <td class="td-3"><br>其他需要说<br>明的情况</td>
        <td class="td-2" style="text-align: left;">
        	<p id="remark" style=" margin-left: 10px;"></p>
        </td>
    </tr>
    <tr>
        <td class="td-1">联系人<br>联系方式</td>
        <td class="td-2">
        	<table  border="0" style="border-width:0 " align="left">
	        	<tr>
	        		<td class="td-1" style="height:30px;text-align: left;" ><p id="workcontactperson" style=" margin-left: 10px;margin-bottom:-2px"></p></td>
	        	</tr>
	        	<tr>
	        		<td class="td-1" style="height:30px;text-align: left;"><p id="workcontactphone" style=" margin-left: 10px;margin-top:-2px"></p></td>
	        	</tr>
        	</table>
        	
        </td>
    </tr>
</table>
</body>
</html>